import '../../../widgets/app_bar/appbar_subtitle.dart';
import '../../../widgets/app_bar/custom_app_bar.dart';
import '../../../widgets/app_bar/outline_icon_button.dart';
import 'my_profile_cubit.dart';
import 'package:flutter/material.dart';
import 'package:syria_sports/core/app_export.dart';

class MyProfileScreen extends StatelessWidget {
  const MyProfileScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    double height = MediaQuery.of(context).size.height;
    double width = MediaQuery.of(context).size.width;

    return Scaffold(
      appBar: _buildAppBar(context),
      body: BlocProvider<MyProfileCubit>(
        create: (context) => MyProfileCubit()..init(),
        child: BlocConsumer<MyProfileCubit, MyProfileState>(
          listener: (context, state) {
            // TODO: implement listener
          },
          builder: (context, state) {
            var cubit = MyProfileCubit.get(context);

            return SizedBox(
              height: height,
              width: width,
              child: SingleChildScrollView(
                child: Container(
                    width: double.maxFinite,
                    padding: EdgeInsets.symmetric(vertical: 36.v),
                    child: const Column(
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: [
                          /*MyCircleAvatar(
                            width: 48,
                            imageURL:user.image ,
                            borderColor: Colors.grey,
                            backgroundColor: Colors.black,
                            active: user.activeValue == '1',
                            activeIconWidth: 32,
                          ),
                          Padding(
                              padding: EdgeInsets.only(top: 9.v, bottom: 14.v),
                              child: Column(children: [
                                Text(user.fullName,
                                    style: theme.textTheme.titleSmall),
                                SizedBox(height: 8.v),
                                SelectableText(user.username??"",
                                    style: theme.textTheme.bodySmall)
                              ])),
                          const Padding(
                            padding: EdgeInsets.all(8.0),
                            child: Divider(color: Colors.white54),
                          ),
                          Column(
                              children: [
                                InfoViewWidget(
                                  icon: Icons.contact_mail_outlined,
                                  value: false,
                                  title: 'معلومات التواصل',
                                  children: [
                                    ListTile(
                                      leading: const Icon(Icons.phone, color: Colors.white54),
                                      title: const Text("رقم الهاتف:",style: TextStyle(fontSize: 14),),
                                      subtitle: SelectableText(user.phone??"لا يوجد",style: const TextStyle(color: Color(0xffbdbab9)),),
                                      //trailing: Icon(Icons.copy, color: Colors.white54),
                                    ),
                                    */
                          /*ListTile(
                                    leading: const Icon(Icons.email, color: Colors.white54),
                                    title: const Text("البريد الالكتروني:",style: TextStyle(fontSize: 14),),
                                    subtitle: SelectableText(user.phone??"لا يوجد",style: const TextStyle(color: Color(0xffbdbab9)),),
                                    //trailing: Icon(Icons.copy, color: Colors.white54),
                                  ),*/
                          /*
                                  ],
                                ),
                                const Padding(
                                  padding: EdgeInsets.all(8.0),
                                  child: Divider(color: Colors.white54),
                                ),
                              ],
                            ),*/
                          /*InfoViewWidget(
                            value: false,
                            icon: Icons.done_outline,
                            title: 'معلومات الاشتراك',
                            children: [
                              ListTile(
                                leading: const Icon(Icons.phone, color: Colors.white54),
                                title: const Text("تاريخ الاشتراك:",style: TextStyle(fontSize: 14),),
                                subtitle: Text(DateTime.now().format(),style: const TextStyle(color: Color(0xffbdbab9)),),
                                //trailing: Icon(Icons.copy, color: Colors.white54),
                              ),
                              ListTile(
                                leading: const Icon(Icons.email, color: Colors.white54),
                                title: const Text("الحالة:",style: TextStyle(fontSize: 14),),
                                subtitle: Text(user.active,style: const TextStyle(color: Color(0xffbdbab9)),),
                                //trailing: Icon(Icons.copy, color: Colors.white54),
                              ),
                            ],
                          ),
                          const Padding(
                            padding: EdgeInsets.all(8.0),
                            child: Divider(color: Colors.white54),
                          ),
                          Card(
                            color: Colors.white10,
                            child: ListTile(
                              onTap: (){
                                Navigator.push(context, MaterialPageRoute(builder: (context) => UserSubscriptionsScreen(
                                  user:user,
                                )));
                              },
                              leading: Icon(Icons.directions_walk,color:Colors.orange.withOpacity(.6)),
                              title: Text("التمارين المنتسب لها",style: theme.textTheme.titleSmall),
                              //subtitle: Text(user.level!,style: CustomTextStyles.bodySmallOnPrimary),
                              trailing: CustomImageView(
                                imagePath: ImageConstant.imgArrowLeftBlueGray300,
                                height: 32.adaptSize,
                                width: 32.adaptSize,
                              ),
                            ),
                          ),
                          Card(
                            color: Colors.white10,
                            child: ListTile(
                              onTap: (){
                                Navigator.push(context, MaterialPageRoute(builder: (context) => UserAttendancesListScreen(
                                  user:user,
                                )));
                              },
                              leading: Icon(Icons.directions_walk,color:Colors.orange.withOpacity(.6)),
                              title: Text("تسجيلات الحضور",style: theme.textTheme.titleSmall),
                              //subtitle: Text(user.level!,style: CustomTextStyles.bodySmallOnPrimary),
                              trailing: CustomImageView(
                                imagePath: ImageConstant.imgArrowLeftBlueGray300,
                                height: 32.adaptSize,
                                width: 32.adaptSize,
                              ),
                            ),
                          ),
*/

                        ])),
              ),


            );
          },
        ),
      ),
    );
  }

  /// Section Widget
  PreferredSizeWidget _buildAppBar(BuildContext context) {
    return CustomAppBar(
      leading: OutlineIconButton(
        imagePath: ImageConstant.imgRightIcon,
        onTapped: (){
          Navigator.pop(context);
        },
      ),
      title: AppbarSubtitle(
        text: "الملف الشخصي", margin: EdgeInsets.only(left: 12.h),
      ),
    );
  }
}
